package com.it.server.mapper;

import com.github.pagehelper.Page;
import com.it.pojo.DTO.OrdersPageQueryDTO;
import com.it.pojo.Entity.Orders;
import com.it.pojo.VO.OrdersVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface OrderMapper {
    /**
     * 插入订单
     * @param orders
     */
    void insert(Orders orders);
    /**
     * 更新订单
     * @param orders
     */
    void update(Orders orders);
    /**
      * 根据订单编号和用户id查询订单
      * @param outTradeNo
     */
    @Select("select * from orders where number = #{outTradeNo} and user_id = #{userId}")
    Orders getByNumberAndUserId(String outTradeNo, Long userId);
    @Select("select * from orders where id = #{id}")
    Orders getById(Integer id);

    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);
}
